package com.example.librarymanagementproject2.model.document;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @ClassName BorrowRecordDocument
 * @Description 借阅图书记录信息文档
 * @Author Kx
 * @Date 2025/10/29 9:06
 * @Version 1.0
 */
@Document(indexName = "borrowRecord", createIndex = false)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BorrowRecordDocument {
    @Id
    private Long id; // 记录编号
    @Field(type = FieldType.Long, index = false)
    private Long userId; // 用户Id
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String realName; // 真实姓名
    @Field(type = FieldType.Long, index = false)
    private Long bookId; // 图书Id
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String bookName; // 图书名称
    @Field(type = FieldType.Date, index = false)
    private Date borrowDate; // 借阅日期
    @Field(type = FieldType.Date, index = false)
    private Date dueDate; // 应还日期
    @Field(type = FieldType.Date, index = false)
    private Date returnDate; // 还书日期
    @Field(type = FieldType.Keyword, index = false)
    private String status; // 状态
    @Field(type = FieldType.Integer, index = false)
    private Integer renewCount; // 续借次数
    @Field(type = FieldType.Keyword, index = false)
    private String auditStatus; // 审核状态
    @Field(type = FieldType.Keyword, index = false)
    private String auditRemark; // 审核备注
}
